{% extends 'AdminPanelDashboardBundle::layout.html.twig' %}


{% block stylesheets %}
  {{ parent() }}
{% endblock %}
{% block javascripts %}      
  {{ parent() }}
{% endblock %}


{% block content %}

<div id="content">
  <ul class="breadcrumb">
    <li><a href="/admin" class="glyphicons home"><i></i> Нүүр</a></li>
    <li class="divider"></li>
    <li>Гэрээ</li>
  </ul>
  <div class="separator"></div>

  <div class="heading-buttons">
    <h3 class="glyphicons sort"><i></i> Гэрээний жагсаалт</h3>    
  </div>
  <div class="separator"></div>

  <div class="innerLR">
    <div>
      <form action="{{path('contractList')}}" method="post">
        <table>
          <tr>
            <td>Эхлэх огоо : </td>
            <td><input type="text" class="datePicker" name="beginDate" value="{{beginDate}}"></td>
            <td>Дуусах огоо : </td>
            <td><input type="text" class="datePicker" name="endDate" value="{{endDate}}"></td>                    
            <td>Төлөв : </td>
            <td>
              <select name="type">
                <option value="all" {% if type is null %} selected="selected" {% endif %}>Бүгд</option>
                <option value="created" {% if type == 'created' %} selected="selected" {% endif %}>Үүсгэсэн</option>
                <option value="complete" {% if type == 'complete' %} selected="selected" {% endif %}>Болсон</option>
                <option value="userDenied" {% if type == 'userDenied' %} selected="selected" {% endif %}>Сурагч татгалзсан</option>
                <option value="tutorCanceled" {% if type == 'tutorCanceled' %} selected="selected" {% endif %}>Багш цуцалсан</option>
                <option value="userCanceled" {% if type == 'userCanceled' %} selected="selected" {% endif %}>Сурагч цуцалсан</option>
                <option value="adminDenied" {% if type == 'adminDenied' %} selected="selected" {% endif %}>Админ татгалзсан</option>
                <option value="deleted" {% if type == 'deleted' %} selected="selected" {% endif %}>Устгасан</option>
              </select>
            </td>            
          </tr>
          <tr>
            <td>Багш : </td>
            <td>              
              <select name="tutor">
                <option value="all">Бүгд</option>
                {% if tutorList is not null%}
                  {% for key, value in tutorList %}
                <option value="{{key}}" {% if tutor == key %} selected="selected" {% endif %}>{{value}}</option>
                  {% endfor %}
                {% endif %}
              </select>
            </td>
            <td>Сурагч : </td>
            <td>                       
              <select name="student">
                <option value="all">Бүгд</option>
                {% if studentList is not null%}
                  {% for key, value in studentList %}
                    <option value="{{key}}" {% if student == key %} selected="selected" {% endif %}>{{value}}</option>
                  {% endfor %}
                {% endif %}
              </select>
            </td>
            <td style="text-align: right">              
            </td>
            <td>
              <input type="button" onclick="javascript: document.location.href = '/admin/contract/list'" value="Цэвэрлэх" />              
              <input type="submit" value="Хайх" />
            </td>
          </tr>
        </table>
      </form>
    </div>
    <div>
      <table class="table table-bordered table-condensed table-striped table-vertical-center checkboxs js-table-sortable">
        <thead>
          <tr>
            <th style="width: 30px">№</th>
            <th>Хичээлийн бүлэг</th>
            <th>Хичээлийн нэр</th>
            <th style="width: 120px">Багш</th>
            <th style="width: 120px">Сурагч</th>
            <th style="width: 80px">Төлөв</th>
            <th style="width: 120px">Үүсгэсэн огноо</th>
            <th style="width: 150px">Нэхэмжлэхийн дугаар</th>
            <th style="width: 150px">Төлбөрийн хэмжээ</th>            
            <th style="width: 150px">Төлбөр төлсөн байдал</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          {% set counter = 1%}
          {% for contract in contractList %}
          <tr>
            <td>{{counter}}</td>
            <td>{{contract.SUBJECT_CATEGORY_NAME}}</td>
            <td>{{contract.SUBJECT_NAME}}</td>
            <td>{{contract.TUTOR_NAME}}</td>
            <td>{{contract.STUDENT_NAME}}</td>
            <td>{% render url('statusNameChange', { 'status': contract.STATUS}) %}</td>
            <td>{{contract.CREATED_AT}}</td>
            <td>{{contract.INVOICE_NUMBER}}</td>
            <td>{{contract.AMOUNT}}</td>
            <td>{{contract.AMOUNT_PAID}}</td>
            <td></td>
          </tr>
          {% set counter = counter + 1 %}
          {% endfor %}
        </tbody>
      </table>
      <div>
        
      </div>
    </div>
  </div>
  <br/>		
  <!-- End Content -->
</div>

{% endblock %}
